import System.Random

isPrime n [] = True
isPrime n (x:xs)
        | n `rem` x == 0 = False
        | otherwise = isPrime n xs

nats = [1,3..]
primes = [x | x <- nats, isPrime x [2..(round $ sqrt $ fromIntegral x)]]

--fermatTest n 0 _ = True
--fermatTest n k (x:xs)
--           | x^(n-1) `mod` n /= 1 = False
--           | otherwise = fermatTest n (k-1) xs

--main :: IO ()
--main =  do gen  <- getStdGen
--           print $ last $ take 10001 (primes gen)
    
